<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <link rel="stylesheet" href="/layui/css/layui.css">
    <title>Title</title>
</head>
<body>
<div class="layui-container" style="width:400px;">
    <form action="" class="layui-form" id="waihuForm">
        <div class="layui-form-item">
            <div class="layui-input-block">
                <input type="number" name="phoneWH" class="layui-input" lay-verify="phoneWH"/>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label"></label>
            <div class="layui-input-block">
                <button id="myButton" class="layui-btn  layui-btn-normal" lay-submit lay-filter="baseSubmit">呼叫</button>
                <button class="layui-btn" lay-submit lay-filter="blacklist"  onclick="addHmd()"  >加入黑名单</button>
            </div>
        </div>
    </form>
</div>
<script src="/layui/layui.all.js"></script>
<script src="/js/core.util.js"></script>
<script>

    //获取token
    var token = CoreUtil.getData("access_token");
    //地址栏转义token中的#号
    var tokenQuery = token.replace("#", "%23");
    var tableIns1;
    var table = layui.table;
    var form = layui.form;
    var layer = layui.layer;
    var $ = jQuery = layui.jquery;
    var laydate = layui.laydate;

    layui.use(['table', 'layer', 'laydate'], function () {

        form.on('submit(baseSubmit)', function (data) {
            $(this).addClass('layui-btn-disabled'); // 添加置灰类
            layer.msg("云点呼正在检测被叫黑名单，请稍等！", {time: 2000}, function () {
                CoreUtil.sendPost("/tSeats/outbound", data.field, function (res) {
                        layer.msg(res.msg)
                });
            });
            setTimeout(function(){ // 设置定时器
                $('#myButton').removeClass('layui-btn-disabled'); // 移除置灰类
            }, 2000);
            return false;
        })
        form.on('submit(blacklist)', function (data) {

            layer.open({
                content: "确定要  "+data.field.phoneWH+"  加入黑名单么?",
                yes: function (index, layero) {
                    CoreUtil.sendPost("/tBacklist/add", data.field, function (res) {
                        layer.msg(data.field.phoneWH+"已加入黑名单", {time: 2000}, function () {

                        });
                    });
                }
            });

            return false;
        })
        //自定义验证规则
        form.verify({
            // phoneWH: [/^1[3|4|5|6|7|8|9]\d{9}$/, '手机必须11位，只能是数字。']
        });
    });





</script>
</body>
</html>